package com.jalarbee.core.util.validation;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class ValidationResult implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private List<ValidationError> errors = null;
	
	public boolean hasErrors() {
		return ! errors.isEmpty();
	}
	
	public ValidationResult() {
		errors = new ArrayList<ValidationError>();
	}
	
	public ValidationResult addError(ValidationError error) {
		errors.add(error);
		return this;
	}
	
	public int getErrorCount() {
		if(errors != null) {
			return errors.size();
		}
		return 0;
	}

}
